package evaluation.results;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileFilter;
import java.io.FileReader;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

public class SizeFilter implements FileFilter{

	private List<String> names;

	public SizeFilter(File file, int number) throws IOException {
		
		BufferedReader br = new BufferedReader(new FileReader(file));
		
		String line;
		
		int index = 0;
		
		names = new ArrayList<String>();
		
		while (((line = br.readLine())!=null) && index < number){
			
			names.add(line);
			
			index++;
		}
		
		br.close();
		
	}

	@Override
	public boolean accept(File pathname) {
		
		return names.contains(pathname.getName());
		
	}
	
}